//
//  AISMusicPlayer.h
//  CantonController
//
//  Created by Ares on 5/6/15.
//  Copyright (c) 2015 Ares. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <MediaPlayer/MediaPlayer.h>

@protocol AISMusicPlayerDelegate;


@interface AISMusicPlayer : NSObject

@property(nonatomic, retain) MPMediaItemCollection *playerItemCollection;

+ (AISMusicPlayer *)sharedInstance;

@property(nonatomic, weak) id<AISMusicPlayerDelegate> delegate;

- (NSString *)currentTrackName;
- (NSString *)currentTrackArtist;
- (UIImage *)currentTrackThumbnail;
- (MPMusicPlaybackState)currentPlayStatus;
- (NSTimeInterval)currentPlaybackTime;
- (void)setPlaybackTime:(NSTimeInterval)startTime;
- (NSTimeInterval)currentPlaybackDuration;

- (BOOL)hasMusicToPlay;
- (BOOL)isNowPlayingItem:(MPMediaItem *)item;

- (void)playMusicWithIndex:(NSInteger)index;
- (void)play;
- (void)pause;
- (void)next;
- (void)previous;

@end


@protocol AISMusicPlayerDelegate <NSObject>

@optional
- (void)musicPlayerDidPlayingItemChanged;
- (void)musicPlayerDidPlaybackStateChanged;

@end